var path = require('path')
var htmlWebpackPlugin = require('html-webpack-plugin')
const { VueLoaderPlugin } = require('vue-loader')

module.exports = {
    entry: path.join(__dirname , './src/main.js'),
    output: {
        path: path.join(__dirname , './dist'),
        filename: 'bundle.js'
    },
    plugins: [
        new htmlWebpackPlugin({
            template: path.join(__dirname , './src/index.html'),
            filename: 'index.html'
        }),
        new VueLoaderPlugin()
    ],
    module: {
        rules:[
            { test: /\.vue$/ , use: 'vue-loader' },
            { test: /\.css$/ , use: ['style-loader' , 'css-loader'] },
            { test: /\.less$/ , use: ['style-loader' , 'css-loader', 'less-loader'] },
            { test: /\.scss$/, use: ['style-loader', 'css-loader', 'sass-loader'] }, // 处理 scss 文件的 loader
            { test: /\.(jpg|jpeg|png|gif|bmp|ttf|svg)$/ , use: 'url-loader?limit=37882&name=[hash:8]-[name].[ext]' },             //给定一个最大值，单位是byte，如果图片大于则转Base64
            { test: /\.js$/ , use: 'babel-loader' , exclude: /node_modules/ }       //配置babel转化过来的高级ES语法
            
        ]
    }

}